package edu.nf.llmtest.common.converter;

import edu.nf.llmtest.model.document.EssayDoc;
import edu.nf.llmtest.model.dto.EssayDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @ Author bin
 * @ Create  2025/11/7 11:42
 * 文章转换器
 **/
@Mapper(componentModel = "spring", uses = UserConverter.class)
public interface EssayDTOConverter {
    @Mappings(
            {
                    @Mapping(source = "EId", target = "EId"),
                    @Mapping(source = "user", target = "user"),
                    @Mapping(source = "types", target = "types"),
                    @Mapping(source = "title", target = "title"),
                    @Mapping(source = "content", target = "content"),
                    @Mapping(source = "status", target = "status"),
                    @Mapping(source = "images", target = "images"),
                    @Mapping(source = "createTime", target = "createTime")
            }
    )
    EssayDoc convertEssayDTODoc(EssayDTO essayDTO);

    @Mappings(
            {
                    @Mapping(source = "EId", target = "EId"),
                    @Mapping(source = "user", target = "user"),
                    @Mapping(source = "types", target = "types"),
                    @Mapping(source = "title", target = "title"),
                    @Mapping(source = "content", target = "content"),
                    @Mapping(source = "status", target = "status"),
                    @Mapping(source = "images", target = "images"),
                    @Mapping(source = "createTime", target = "createTime")
            }
    )
    EssayDTO convertEssayDTO(EssayDoc essayDoc);
}
